<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<link rel="stylesheet" href="./../css/baicaijia.css">
<script src="./../js/flexible.js"></script>

<body>
    <!-- 头部 -->
    <div class="hand">
        <a href="./index.html">&lt;</a>
        <h4>白菜价-淘宝内部优惠卷</h4>
        <a href=""><img src="./../assets/images/header_app.png" alt=""></a>
    </div>


    <!-- 内容 -->
    <!-- <nav> -->
        <div class="menu1">
            <ul class="uu">
                <li></li>
            </ul>
        </div>
    <!-- </nav> -->
    <div class="neirong">
        <ul class="ab">
            <li>
                <a href="" class="clearfix">
                    <div class="imgdl">
                        <img src="" alt="">
                    </div>
                    <div class="infor">
                        <div class="title">
                            <h4></h4>
                            <div class="price"></div>
                        </div>
                        <div class="down">
                            <div class="bar"></div>
                            <span class="yiling"></span>
                            <div class="click">
                                <div class="left"></div>
                                <div class="right"></div>
                            </div>
                        </div>
                    </div>
                </a>
            </li>
        </ul>
    </div>
    <!-- 底部 -->
    <div id="footer">
        <div class="more">
            <a href>更多优惠信息&gt;&gt;</a>
        </div>
        <div class="chart">
            <span class="chart-1">品牌排行</span>
            <span class="chart-2">&gt;&gt;</span>
        </div>
        <div class="login">
            <div class="row-1">
                <a href="">
                    <div>登入</div>
                </a>
                <a href="">
                    <div>注册</div>
                </a>
                <a href="">
                    <div>返回顶部</div>
                </a>
            </div>
            <div class="row-2">
                <p>
                    <a href="">手机APP下载</a>
                    <a href="">慢慢买手机版</a>
                    "--掌上比价平台"
                </p>
                <p>m.manmanbuy.com </p>
            </div>

        </div>
    </div>
</body>

</html>
<script>
    //  fetch("http://chst.vip:1234/api/getmoneyctrl")
    // fetch("http://chst.vip:1234/api/getbaicaijiatitle?pageid=1")
    // 请求头部接口
    fetch("http://chst.vip:1234/api/getbaicaijiatitle")
        .then(body => body.json())
        .then(res => {
            console.log(res.result, 5555);
            let html = "";
            let uu = document.querySelector(".uu")
            res.result.forEach(item => {
                html += `
                <li titleId=${item.titleId}>
                    ${item.title}
                    </li>
                    `
            })
            uu.innerHTML = html

            //点击事件
            let lis = document.querySelector(".uu li");
            console.log(lis);
            [...lis].forEach(li => {
                li.onclick = function () {
                    let titleId = this.getAttribute("titleId")
                    console.log(titleId);
                    location.href = `./baicaijia.html?productid=${titleId}`
                }
            })
        })
    // 请求内容
    fetch("http://chst.vip:1234/api/getbaicaijiaproduct?titleid=0")
        // fetch("http://chst.vip:1234/api/getbaicaijiaproduct")
        .then(body => body.json())
        .then(ree => {
            console.log(ree, 666);
            let html = "";
            let ab = document.querySelector(".ab")
            ree.result.forEach(item => {

                html += `
                <li productId=${item.productId}>
                    <a href>
                        <div>
                        ${item.productImg}
                        </div>
                        <div>
                        <h4>${item.productName}</h4>
                        
                        <div>${item.productPrice}</div>
                        </div>
                        <div>
                        <div></div>
                        <span></span>
                        <div>
                        <div></div>
                        <div></div>
                        </div>
                        </div>
                        </a>
                        </li>
                `
            })
            ab.innerHTML = html
        })

</script>
<script src="https: //cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<!-- <script src="./../js/bcj.js"></script> -->